package com.neuedu.jdboot.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.neuedu.jdboot.bean.Admin;

/**
 * 
 * @author chens
 *
 */
public interface AdminMapper extends BaseMapper<Admin> {

	/**
	 * 0-未激活，1-在职，2-离职
	 * 
	 * @param adminId
	 * @param status
	 * @return
	 */
	@Update("update admin set status =#{status} where  id = #{id} and flag!=1 ")
	public boolean updateStatus(@Param(value = "id") Integer id, @Param(value = "status") Integer status);

	/**
	 * 用户登录
	 * 
	 * @param account
	 * @return
	 */
	@Select("select a.*,r.id 'role.id',r.name 'role.name',r.flag 'role.flag' from admin a join role r on a.roleId=r.id where a.account=#{account}")
	Admin login(String account);
}
